
*----------------------------------------------------------------------------------------------------------	* 
* RESEARCHERS:		Emtiaz Hritan, Tim Bruckner									   							*
* PROGRAMMED BY:	Emtiaz Hritan																			*
* DESCRIPTION:      The Politics of Birth: How Local Representation Shapes Maternal-Infant Outcomes				 						 	*
* CREATED:			Sep. 10, 2025																		   	*
* LAST MODIFIED:	Jan. 27, 2026													       					*
*----------------------------------------------------------------------------------------------------------	*

clear all
set more off
* Set local paths
* Set this local datapath equal to the folder location for data
	local datapath "C:\Users\name\Replication Files Politics of Birth\Data"
* Set this local outputpath equal to the folder location for outcome like tables
	local outputpath "C:\Users\name\Replication Files Politics of Birth\Outcome"


*--------------------------------------------------------------------------
* Figures A1 and A2: Trend Analysis: County-level candidate share data
*--------------------------------------------------------------------------
clear all 
cd "`datapath'"
use candidate


* --- 0) Keep the relevant offices and years ---
keep if inlist(office_consolidated, "County Executive", "County Legislature")
keep if inrange(year, 1989, 2021)

* --- 1) Indicators for numerators ---
gen i_female  = (gender_est == "F")
gen i_black   = (race_est   == "black")
gen i_asian   = (race_est   == "asian")
gen i_hisp    = (race_est   == "hispanic")
gen i_dem     = (pid_est    == "D")

* --- 2) Attribute-specific denominators (exclude missing/irrelevant categories) ---
gen d_gender = inlist(gender_est, "F", "M")                             // gender known
gen d_race   = inlist(race_est, "asian","black","hispanic","caucasian","other")   // race known
gen d_pid    = inlist(pid_est, "D", "R")                                // party known

* --- 3) Collapse to year level (sums become counts) ---
collapse (sum) i_female i_black i_asian i_hisp i_dem d_gender d_race d_pid, by(year)

* --- 4) Shares (percent) using attribute-specific denominators ---
gen share_female = 100 * i_female / d_gender
gen share_black  = 100 * i_black  / d_race
gen share_asian  = 100 * i_asian  / d_race
gen share_hisp   = 100 * i_hisp   / d_race
gen share_dem    = 100 * i_dem    / d_pid

label var share_female "Female"
label var share_black  "Black"
label var share_asian  "Asian"
label var share_hisp   "Hispanic"
label var share_dem    "Democrat"

* --- 5) One graph: shares over time ---
twoway ///
  (line share_female year, lwidth(medthick)) ///
  (line share_black  year, lpattern(dash)       lwidth(medthick)) ///
  (line share_asian  year, lpattern(shortdash)  lwidth(medthick)) ///
  (line share_hisp   year, lpattern(longdash)   lwidth(medthick)) ///
  (line share_dem    year, lpattern(dash_dot)        lwidth(medthick)), ///
  title("Shares of county candidates by group, 1989–2021") ///
  xtitle("Year") ytitle("Percent of candidates") ///
  legend(order(1 2 3 4 5) cols(3) pos(6) ring(4)) 

graph export "`outputpath'\all_groups_share.pdf", as(pdf) name("Graph")

*********************************************************************************************************************
** Figure A2 (a):Trends in Political Representation of Racial and Ethnic Minorities in County Elections,1989–2021. **
*********************************************************************************************************************
gen share_black_lbl = "" 
replace share_black_lbl = string(round(share_black,0.1), "%4.1f") if inlist(year,1990,2000,2010,2020)

gen share_asian_lbl = "" 
replace share_asian_lbl = string(round(share_asian,0.1), "%4.1f") if inlist(year,1990,2000,2010,2020)

gen share_hisp_lbl = "" 
replace share_hisp_lbl = string(round(share_hisp,0.1), "%4.1f") if inlist(year,1990,2000,2010,2020)



twoway ///
  (line share_black year, lcolor(blue) lwidth(medthick)) ///
  (scatter share_black year, msymbol(O) mcolor(blue) ///
       mlabel(share_black_lbl) mlabpos(12) mlabsize(small) mlabcolor(blue)) ///
  (line share_asian year, lcolor(red) lpattern(shortdash) lwidth(medthick)) ///
  (scatter share_asian year, msymbol(O) mcolor(red) ///
       mlabel(share_asian_lbl) mlabpos(12) mlabsize(small) mlabcolor(red)) ///
  (line share_hisp year, lcolor(black) lpattern(longdash) lwidth(medthick)) ///
  (scatter share_hisp year, msymbol(O) mcolor(black) ///
       mlabel(share_hisp_lbl) mlabpos(12) mlabsize(small) mlabcolor(black)), ///
  title("Shares of County Candidates by Race/Ethnicity, 1989–2021") ///
  xtitle("Year") ytitle("Percent of Candidates") ///
  legend(order(1 "Black" 3 "Asian" 5 "Hispanic") cols(3) pos(6) ring(4)) 
  
  
graph export "`outputpath'\racial_share.pdf", as(pdf) name("Graph") replace


***********************************************************************************************
** Figure A1 (a): Trends in Female Political Representation in County Elections, 1989–2021.  **
***********************************************************************************************


gen share_female_lbl = "" 
replace share_female_lbl = string(round(share_female,0.1), "%4.1f") if inlist(year,1990,2000,2010,2020)

* --- create min/max labels for female (labels all ties; see note below) ---
quietly {
    egen fem_min = min(share_female)
    egen fem_max = max(share_female)
}
gen lbl_fem_ext = ""
replace lbl_fem_ext = string(round(share_female,0.1), "%4.1f") ///
    if inlist(share_female, fem_min, fem_max)
	
twoway ///	
 (line    share_female year, lcolor(navy) lwidth(medthick)) ///
  (scatter share_female year, msymbol(O) mcolor(navy)) ///
  (scatter share_female year if share_female_lbl!="", ///
           mlabel(share_female_lbl) mlabpos(12) mlabsize(small) mlabcolor(green) ///
           msymbol(none)) ///
  (scatter share_female year if lbl_fem_ext!="", ///
           mlabel(lbl_fem_ext) mlabpos(9) mlabsize(small) mlabcolor(green) ///
           msymbol(none)), ///
  title("Female Share of County Candidates, 1989–2021") ///
  xtitle("Year") ytitle("Percent of Candidates") ///
  xlabel(1990(10)2020, grid) ///
  legend(off)	
	
	



*--------------------------------------------------------------------------
* Figures A1 and A2: Trend Analysis: County-level elected candidate share data
*--------------------------------------------------------------------------
clear all 
cd "`datapath'"
use candidate


* --- 0) Keep the relevant offices and years ---
keep if inlist(office_consolidated, "County Executive", "County Legislature")
keep if inrange(year, 1989, 2021)

* --- 1) Indicators for numerators ---
gen i_female  = (gender_est == "F")
gen i_black   = (race_est   == "black")
gen i_asian   = (race_est   == "asian")
gen i_hisp    = (race_est   == "hispanic")
gen i_dem     = (pid_est    == "D")

* --- 2) Attribute-specific denominators (exclude missing/irrelevant categories) ---
gen d_gender = inlist(gender_est, "F", "M")                             // gender known
gen d_race   = inlist(race_est, "asian","black","hispanic","caucasian","other")   // race known
gen d_pid    = inlist(pid_est, "D", "R")                                // party known

keep if winner=="win"

* --- 3) Collapse to year level (sums become counts) ---

collapse (sum) i_female i_black i_asian i_hisp i_dem d_gender d_race d_pid, by(year)

* --- 4) Shares (percent) using attribute-specific denominators ---
gen share_female = 100 * i_female / d_gender
gen share_black  = 100 * i_black  / d_race
gen share_asian  = 100 * i_asian  / d_race
gen share_hisp   = 100 * i_hisp   / d_race
gen share_dem    = 100 * i_dem    / d_pid

label var share_female "Female"
label var share_black  "Black"
label var share_asian  "Asian"
label var share_hisp   "Hispanic"
label var share_dem    "Democrat"

* --- 5) One graph: shares over time ---
twoway ///
  (line share_female year, lwidth(medthick)) ///
  (line share_black  year, lpattern(dash)       lwidth(medthick)) ///
  (line share_asian  year, lpattern(shortdash)  lwidth(medthick)) ///
  (line share_hisp   year, lpattern(longdash)   lwidth(medthick)) ///
  (line share_dem    year, lpattern(dash_dot)        lwidth(medthick)), ///
  title("Shares of county candidates by group, 1989–2021") ///
  xtitle("Year") ytitle("Percent of candidates") ///
  legend(order(1 2 3 4 5) cols(3) pos(6) ring(4)) 

graph export "`outputpath'\all_groups_share_elected.pdf", as(pdf) name("Graph")

*********************************************************************************************************************
** Figure A2 (b):Trends in Political Representation of Racial and Ethnic Minorities in County Elections,1989–2021. **
*********************************************************************************************************************
gen share_black_lbl = "" 
replace share_black_lbl = string(round(share_black,0.1), "%4.1f") if inlist(year,1990,2000,2010,2020)

gen share_asian_lbl = "" 
replace share_asian_lbl = string(round(share_asian,0.1), "%4.1f") if inlist(year,1990,2000,2010,2020)

gen share_hisp_lbl = "" 
replace share_hisp_lbl = string(round(share_hisp,0.1), "%4.1f") if inlist(year,1990,2000,2010,2020)



twoway ///
  (line share_black year, lcolor(blue) lwidth(medthick)) ///
  (scatter share_black year, msymbol(O) mcolor(blue) ///
       mlabel(share_black_lbl) mlabpos(12) mlabsize(small) mlabcolor(blue)) ///
  (line share_asian year, lcolor(red) lpattern(shortdash) lwidth(medthick)) ///
  (scatter share_asian year, msymbol(O) mcolor(red) ///
       mlabel(share_asian_lbl) mlabpos(12) mlabsize(small) mlabcolor(red)) ///
  (line share_hisp year, lcolor(black) lpattern(longdash) lwidth(medthick)) ///
  (scatter share_hisp year, msymbol(O) mcolor(black) ///
       mlabel(share_hisp_lbl) mlabpos(12) mlabsize(small) mlabcolor(black)), ///
  title("Elected County Candidates by Race/Ethnicity, 1989–2021") ///
  xtitle("Year") ytitle("Percent of Candidates") ///
  legend(order(1 "Black" 3 "Asian" 5 "Hispanic") cols(3) pos(6) ring(4)) 
  
  
graph export "`outputpath'\racial_share_elected.pdf", as(pdf) name("Graph") replace




***********************************************************************************************
** Figure A1 (b): Trends in Female Political Representation in County Elections, 1989–2021.  **
***********************************************************************************************


gen share_female_lbl = "" 
replace share_female_lbl = string(round(share_female,0.1), "%4.1f") if inlist(year,1990,2000,2010,2020)

* --- create min/max labels for female (labels all ties; see note below) ---
quietly {
    egen fem_min = min(share_female)
    egen fem_max = max(share_female)
}
gen lbl_fem_ext = ""
replace lbl_fem_ext = string(round(share_female,0.1), "%4.1f") ///
    if inlist(share_female, fem_min, fem_max)
	
twoway ///	
 (line    share_female year, lcolor(navy) lwidth(medthick)) ///
  (scatter share_female year, msymbol(O) mcolor(navy)) ///
  (scatter share_female year if share_female_lbl!="", ///
           mlabel(share_female_lbl) mlabpos(12) mlabsize(small) mlabcolor(green) ///
           msymbol(none)) ///
  (scatter share_female year if lbl_fem_ext!="", ///
           mlabel(lbl_fem_ext) mlabpos(9) mlabsize(small) mlabcolor(green) ///
           msymbol(none)), ///
  title("Female Share of Elected County Candidates, 1989–2021") ///
  xtitle("Year") ytitle("Percent of Candidates") ///
  xlabel(1990(10)2020, grid) ///
  legend(off)	
	
	
graph export "`outputpath'\female_candidates_share_elected.pdf", as(pdf) name("Graph") replace





******************************************************************************************************************************
* Figure A5: Note: Temporal distribution of first-time electoral victories by gender and race/ethnicityacrossU.S. counties, 1995–2019
******************************************************************************************************************************


clear all
use "`datapath'\final.dta"

preserve
duplicates drop county_fips year_black,force


    keep county_fips year_black
    keep if !missing(year_black) & inrange(year_black, 1996, 2019)

    collapse (count) n_counties = county_fips, by(year_black)
    rename year_black year
    sort year
grstyle init
grstyle set plain
    twoway (bar n_counties year, fcolor(none) lcolor(black)), ///
        title("First Black Candidate Wins per Year") ///
        xtitle("Year") ytitle("Number of Counties") ///
        xlabel(1995(2)2019, angle(45)) 
restore


preserve
duplicates drop county_fips year_female,force


    keep county_fips year_female
    keep if !missing(year_female) & inrange(year_female, 1996, 2019)

    collapse (count) n_counties = county_fips, by(year_female)
    rename year_female year
    sort year
grstyle init
grstyle set plain
    twoway (bar n_counties year, fcolor(none) lcolor(black)), ///
        title("First Female Candidate Wins per Year") ///
        xtitle("Year") ytitle("Number of Counties") ///
        xlabel(1995(2)2019, angle(45)) 
restore



preserve
duplicates drop county_fips year_hispanic,force


    keep county_fips year_hispanic
    keep if !missing(year_hispanic) & inrange(year_hispanic, 1996, 2019)

    collapse (count) n_counties = county_fips, by(year_hispanic)
    rename year_hispanic year
    sort year
grstyle init
grstyle set plain
    twoway (bar n_counties year, fcolor(none) lcolor(black)), ///
        title("First Hispanic Candidate Wins per Year") ///
        xtitle("Year") ytitle("Number of Counties") ///
        xlabel(1995(2)2019, angle(45)) 
restore



preserve
duplicates drop county_fips year_asian,force


    keep county_fips year_asian
    keep if !missing(year_asian) & inrange(year_asian, 1996, 2019)

    collapse (count) n_counties = county_fips, by(year_asian)
    rename year_asian year
    sort year
grstyle init
grstyle set plain
    twoway (bar n_counties year, fcolor(none) lcolor(black)), ///
        title("First Asian Candidate Wins per Year") ///
        xtitle("Year") ytitle("Number of Counties") ///
        xlabel(1995(2)2019, angle(45)) 
restore



*--------------------------------------------------------------------------
* Trend Analysis: County-level Perinatal data
*--------------------------------------------------------------------------

* First, we limit our outcome variables to the following for graphical analysis:
*births_all
*deaths_neonat_all 
*births_ptb_all
*births_vptb_all
*births_eptb_all
*births_lbw_all
*births_vlbw_all
*births_csection_all
*births_periviable_all
*births_previsit_all

*births_HSP
*deaths_neonat_HSP
*births_ptb_HSP
*births_vptb_HSP
*births_eptb_HSP
*births_lbw_HSP
*births_vlbw_HSP
*births_csection_HSP
*births_periviable_HSP
*births_previsit_HSP

*births_NHB
*deaths_neonat_NHB
*births_ptb_NHB
*births_vptb_NHB
*births_eptb_NHB
*births_lbw_NHB
*births_vlbw_NHB
*births_csection_NHB
*births_periviable_NHB
*births_previsit_NHB

*births_NHW
*deaths_neonat_NHW
*births_ptb_NHW
*births_vptb_NHW
*births_eptb_NHW
*births_lbw_NHW
*births_vlbw_NHW
*births_csection_NHW
*births_periviable_NHW
*births_previsit_NHW

 
*************************************************************************
**  Figure A6, A7, A8: Perinatal outcome trends
************************************************************************ 
 
*****************************Never vs. Ever Minority (Black)********************
* Keep the counties in our sample 
clear all
use "`datapath'\county_election.dta"
keep county_fips  never_black
duplicates drop county_fips, force
sort county_fips
tempfile sample_county
    save `sample_county' 

* import perinatal file
use "`datapath'\county_year_birth_death.dta"	
merge m:1 county_fips using `sample_county' 
keep if _merge==3
drop _merge


*Collapse to year × group
*    Sum counts; mean for prenatal visits (births_previsit_all)
collapse ///
    (sum) births_all deaths_neonat_all ///
          births_ptb_all births_vptb_all births_eptb_all ///
          births_lbw_all births_vlbw_all ///
          births_csection_all births_periviable_all ///
		  births_HSP deaths_neonat_HSP births_ptb_HSP births_vptb_HSP ///
          births_eptb_HSP births_lbw_HSP births_vlbw_HSP ///
          births_csection_HSP births_periviable_HSP  ///
		  births_NHB deaths_neonat_NHB births_ptb_NHB births_vptb_NHB  ///
		  births_lbw_NHB births_vlbw_NHB births_csection_NHB births_eptb_NHB ///
          births_periviable_NHB births_NHW deaths_neonat_NHW ///
          births_ptb_NHW births_vptb_NHW births_eptb_NHW births_lbw_NHW ///
          births_vlbw_NHW births_csection_NHW births_periviable_NHW ///	   
    (mean) births_previsit_all births_previsit_HSP births_previsit_NHB births_previsit_NHW births_gestation_all infant_mortality_rate, ///
    by(year never_black)

	
*Build rates (guards for zero denominators)
gen imr                = 1000 * deaths_neonat_all  / births_all           if births_all>0   // per 1,000
gen ptb_rate           = 100  * births_ptb_all     / births_all           if births_all>0   // %
gen vptb_rate          = 100  * births_vptb_all    / births_all           if births_all>0   // %
gen eptb_rate          = 100  * births_eptb_all    / births_all           if births_all>0   // %
gen lbw_rate           = 100  * births_lbw_all     / births_all           if births_all>0   // %
gen vlbw_rate          = 100  * births_vlbw_all    / births_all           if births_all>0   // %
gen csection_rate      = 100  * births_csection_all/ births_all           if births_all>0   // %
gen periviable_rate    = 100  * births_periviable_all / births_all        if births_all>0   // %
label var births_previsit_all "Avg. prenatal visits (mean)"	

gen imr_HSP                = 1000 * deaths_neonat_HSP  / births_HSP           if births_HSP>0   // per 1,000
gen ptb_rate_HSP           = 100  * births_ptb_HSP     / births_HSP           if births_HSP>0   // %
gen vptb_rate_HSP          = 100  * births_vptb_HSP    / births_HSP           if births_HSP>0   // %
gen eptb_rate_HSP          = 100  * births_eptb_HSP    / births_HSP           if births_HSP>0   // %
gen lbw_rate_HSP           = 100  * births_lbw_HSP     / births_HSP           if births_HSP>0   // %
gen vlbw_rate_HSP          = 100  * births_vlbw_HSP    / births_HSP           if births_HSP>0   // %
gen csection_rate_HSP      = 100  * births_csection_HSP/ births_HSP           if births_HSP>0   // %
gen periviable_rate_HSP    = 100  * births_periviable_HSP / births_HSP        if births_HSP>0   // %
label var births_previsit_HSP "Avg. prenatal visits (mean)"	


gen imr_NHB                = 1000 * deaths_neonat_NHB  / births_NHB           if births_NHB>0   // per 1,000
gen ptb_rate_NHB           = 100  * births_ptb_NHB     / births_NHB           if births_NHB>0   // %
gen vptb_rate_NHB          = 100  * births_vptb_NHB    / births_NHB           if births_NHB>0   // %
gen eptb_rate_NHB          = 100  * births_eptb_NHB    / births_NHB           if births_NHB>0   // %
gen lbw_rate_NHB           = 100  * births_lbw_NHB     / births_NHB           if births_NHB>0   // %
gen vlbw_rate_NHB          = 100  * births_vlbw_NHB    / births_NHB           if births_NHB>0   // %
gen csection_rate_NHB      = 100  * births_csection_NHB / births_NHB           if births_NHB>0   // %
gen periviable_rate_NHB    = 100  * births_periviable_NHB / births_NHB        if births_NHB>0   // %
label var births_previsit_NHB "Avg. prenatal visits (mean)"	

gen imr_NHW                = 1000 * deaths_neonat_NHW  / births_NHW           if births_NHW>0   // per 1,000
gen ptb_rate_NHW           = 100  * births_ptb_NHW     / births_NHW           if births_NHW>0   // %
gen vptb_rate_NHW          = 100  * births_vptb_NHW    / births_NHW           if births_NHW>0   // %
gen eptb_rate_NHW          = 100  * births_eptb_NHW    / births_NHW           if births_NHW>0   // %
gen lbw_rate_NHW           = 100  * births_lbw_NHW     / births_NHW           if births_NHW>0   // %
gen vlbw_rate_NHW          = 100  * births_vlbw_NHW    / births_NHW           if births_NHW>0   // %
gen csection_rate_NHW      = 100  * births_csection_NHW / births_NHW           if births_NHW>0   // %
gen periviable_rate_NHW    = 100  * births_periviable_NHW / births_NHW        if births_NHW>0   // %
label var births_previsit_NHW "Avg. prenatal visits (mean)"	

********************************************************************
* Overall trends for all races
********************************************************************
* Preterm (all three severities)
twoway ///
 (connected ptb_rate year if never_black==0, ///
           lcolor(navy) mcolor(navy) ///
           msymbol(O) msize(small) lwidth(medthick)) ///
 (connected ptb_rate year if never_black==1, ///
           lcolor(maroon) mcolor(maroon) ///
           msymbol(O) msize(small) ///
           lpattern(dash) lwidth(medthick)) ///
 , ///
 title("Preterm Birth Rate (PTB <37w), Ever vs. Never Black") ///
 ytitle("Percent of births") xtitle("Year") ///
 legend(order(1 "Ever Black" 2 "Never Black") cols(2) pos(6) ring(4))

 twoway ///
 (connected vptb_rate     year if never_black==0, lcolor(navy) mcolor(navy) ///
           msymbol(O) msize(small) lwidth(medthick)) ///
 (connected vptb_rate     year if never_black==1, lcolor(maroon) mcolor(maroon) ///
           msymbol(O) msize(small) ///
           lpattern(dash) lwidth(medthick)) ///
 , ///
 title("Very Preterm Rate (VPTB <32w), Never vs Ever Black") ///
 ytitle("Percent of births") xtitle("Year") ///
 legend(order(1 "Ever Black" 2 "Never Black") cols(3) pos(6) ring(4))  

twoway ///
 (connected eptb_rate     year if never_black==0, lcolor(navy) mcolor(navy) ///
           msymbol(O) msize(small) lwidth(medthick)) ///
 (connected eptb_rate     year if never_black==1, lcolor(maroon) mcolor(maroon) ///
           msymbol(O) msize(small) ///
           lpattern(dash) lwidth(medthick)) ///
 , ///
 title("Extremely Preterm Rate (EPTB <28w), Never vs Ever Black") ///
 ytitle("Percent of births") xtitle("Year") ///
 legend(order(1 "Ever Black" 2 "Never Black") cols(3) pos(6) ring(4))  

* LBW/VLBW
twoway ///
 (connected lbw_rate      year if never_black==0, lcolor(navy) mcolor(navy) ///
           msymbol(O) msize(small) lwidth(medthick)) ///
 (connected lbw_rate      year if never_black==1, lcolor(maroon) mcolor(maroon) ///
           msymbol(O) msize(small) ///
           lpattern(dash) lwidth(medthick)) ///
 , ///
 title("Low Birthweight Rate (<2500g), Never vs Ever Black") ///
 ytitle("Percent of births") xtitle("Year") ///
 legend(order(1 "Ever Black" 2 "Never Black") cols(3) pos(6) ring(4))  

twoway ///
 (connected vlbw_rate     year if never_black==0, lcolor(navy) mcolor(navy) ///
           msymbol(O) msize(small) lwidth(medthick)) ///
 (connected vlbw_rate     year if never_black==1, lcolor(maroon) mcolor(maroon) ///
           msymbol(O) msize(small) ///
           lpattern(dash) lwidth(medthick)) ///
 , ///
 title("Very Low Birthweight Rate (<1500g), Never vs Ever Black") ///
 ytitle("Percent of births") xtitle("Year") ///
 legend(order(1 "Ever Black" 2 "Never Black") cols(3) pos(6) ring(4))  

* IMR (neonatal), C-section, Periviable, Prenatal visits
twoway ///
 (connected imr            year if never_black==0, lcolor(navy) mcolor(navy) ///
           msymbol(O) msize(small) lwidth(medthick)) ///
 (connected imr            year if never_black==1, lcolor(maroon) mcolor(maroon) ///
           msymbol(O) msize(small) ///
           lpattern(dash) lwidth(medthick)) ///
 , ///
 title("Neonatal Mortality (0–27d) per 1,000, Never vs Ever Black") ///
 ytitle("Deaths per 1,000 live births") xtitle("Year") ///
 legend(order(1 "Ever Black" 2 "Never Black") cols(3) pos(6) ring(4))  

twoway ///
 (connected csection_rate  year if never_black==0, lcolor(navy) mcolor(navy) ///
           msymbol(O) msize(small) lwidth(medthick)) ///
 (connected csection_rate  year if never_black==1, lcolor(maroon) mcolor(maroon) ///
           msymbol(O) msize(small) ///
           lpattern(dash) lwidth(medthick)) ///
 , ///
 title("Cesarean Delivery Rate, Never vs Ever Black") ///
 ytitle("Percent of births") xtitle("Year") ///
 legend(order(1 "Ever Black" 2 "Never Black") cols(3) pos(6) ring(4))  

twoway ///
 (connected periviable_rate year if never_black==0, lcolor(navy) mcolor(navy) ///
           msymbol(O) msize(small) lwidth(medthick)) ///
 (connected periviable_rate year if never_black==1, lcolor(maroon) mcolor(maroon) ///
           msymbol(O) msize(small) ///
           lpattern(dash) lwidth(medthick)) ///
 , ///
 title("Periviable Birth Rate (<28w), Never vs Ever Black") ///
 ytitle("Percent of births") xtitle("Year") ///
 legend(order(1 "Ever Black" 2 "Never Black") cols(3) pos(6) ring(4))  

twoway ///
 (connected births_previsit_all year if never_black==0, lcolor(navy) mcolor(navy) ///
           msymbol(O) msize(small) lwidth(medthick)) ///
 (connected births_previsit_all year if never_black==1, lcolor(maroon) mcolor(maroon) ///
           msymbol(O) msize(small) ///
           lpattern(dash) lwidth(medthick)) ///
 , ///
 title("Average Prenatal Visits, Never vs Ever Black") ///
 ytitle("Mean visits") xtitle("Year") ///
 legend(order(1 "Ever Black" 2 "Never Black") cols(3) pos(6) ring(4))  
	
	

twoway ///
 (connected infant_mortality_rate year if never_black==0, lcolor(navy) mcolor(navy) ///
           msymbol(O) msize(small) lwidth(medthick)) ///
 (connected infant_mortality_rate year if never_black==1, lcolor(maroon) mcolor(maroon) ///
           msymbol(O) msize(small) ///
           lpattern(dash) lwidth(medthick)) ///
 , ///
 title("Infant Mortality Rate per 1,000, Never vs Ever Black") ///
 ytitle("Deaths per 1,000 live births") xtitle("Year") ///
 legend(order(1 "Ever Black" 2 "Never Black") cols(3) pos(6) ring(4))  	
	
	
	
	
twoway ///
 (connected births_gestation_all year if never_black==0, lcolor(navy) mcolor(navy) ///
           msymbol(O) msize(small) lwidth(medthick)) ///
 (connected births_gestation_all year if never_black==1, lcolor(maroon) mcolor(maroon) ///
           msymbol(O) msize(small) ///
           lpattern(dash) lwidth(medthick)) ///
 , ///
 title("Average Gestational Age (in Weeks), Never vs Ever Black") ///
 ytitle("Mean Weeks") xtitle("Year") ///
 legend(order(1 "Ever Black" 2 "Never Black") cols(3) pos(6) ring(4))  	
		
	
 
	
*********************************************************************************
**                             END                                             **                      
*********************************************************************************





















